using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace Slqj.Data
{
	public static class TableGRContact
	{
		public const string Table = "GRContact";
		public const string GRContactID = "GRContactID";
		public const string GuestRoomOrderItemID = "GuestRoomOrderItemID";
		public const string Visitors = "Visitors";
		public const string ContactPhone = "ContactPhone";
	}
	
	[Serializable]
	public class BaseGRContact
		: IDbSessionEntity, IJsonClass
	{
		int m_GRContactID;
		/// <summary>
        /// 
        /// </summary>
        public int GRContactID
        {
            get { return m_GRContactID; }
            set { m_GRContactID = value; }
        }
		
		int m_GuestRoomOrderItemID;
		/// <summary>
        /// 
        /// </summary>
        public int GuestRoomOrderItemID
        {
            get { return m_GuestRoomOrderItemID; }
            set { m_GuestRoomOrderItemID = value; }
        }
		
		string m_Visitors;
		/// <summary>
        /// 
        /// </summary>
        public string Visitors
        {
            get { return m_Visitors; }
            set { m_Visitors = value; }
        }
		
		string m_ContactPhone;
		/// <summary>
        /// 
        /// </summary>
        public string ContactPhone
        {
            get { return m_ContactPhone; }
            set { m_ContactPhone = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_GRContactID = reader[TableGRContact.GRContactID];
            m_GuestRoomOrderItemID = reader[TableGRContact.GuestRoomOrderItemID];
            m_Visitors = reader[TableGRContact.Visitors];
            m_ContactPhone = reader[TableGRContact.ContactPhone];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableGRContact.GRContactID, PrimaryKeyType.Identity, GRContactID);
			writer[TableGRContact.GuestRoomOrderItemID] = GuestRoomOrderItemID;
			writer[TableGRContact.Visitors] = Visitors;
			writer[TableGRContact.ContactPhone] = ContactPhone;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_GRContactID = idd;
        }
		
		public string TableName
        {
            get { return TableGRContact.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_GRContactID = hashToRead["GRContactID"];
			 
             m_GuestRoomOrderItemID = hashToRead["GuestRoomOrderItemID"];
			 
             m_Visitors = hashToRead["Visitors"];
			 
             m_ContactPhone = hashToRead["ContactPhone"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["GRContactID"] = GRContactID;
			 
            hashToFill["GuestRoomOrderItemID"] = GuestRoomOrderItemID;
			 
            hashToFill["Visitors"] = Visitors;
			 
            hashToFill["ContactPhone"] = ContactPhone;
			 
        }

        #endregion
		
	}
}
